//引入路由器包
import SMERouter from "sme-router";

//引入渲染html文件
import loginView from '$v/login'
import advView from '$v/adv'
//引入二级路由模板
import advList from '$v/advList';
import adminList from '$v/adminList';


//实例化路由器并且传入一级路由的作用区域(是一个id)
const router = new SMERouter("app", "html5")

//登录路由
router.route('/login',(req,res)=>{
  res.render(loginView())
})

//广告路由
router.route('/adv',(req,res,next)=>{
    // next(advViews({
    //     subRoute: res.subRoute()
    // }))
    next(advView({
      subRoute: res.subRoute()
  }));
})

router.route("/adv/adminList", (req, res) => {
  res.render(adminList())
})

router.route("/adv/advList", (req, res) => {
  res.render(advList())
})